<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  template="/WEB-INF/layouts/templateAdmin.xhtml">

  <ui:define name="menu">
    <!-- INCLUDE MENU -->
  </ui:define>

  <ui:define name="content">
    <!-- INCLUDE CONTENT -->
    <h1 class="pageTitle">Edit users accounts</h1>

    <h:form>
      <h:commandLink action="back">
        Back to main page
      </h:commandLink>
    </h:form>

    <br />

    <span class="inlineText">On this page you can edit accounts
      of application user. There are #{flowScope.getNbPerson} users</span>

    <h:form id="listPerson">
      <h:dataTable border="2" cellpadding="2" cellspacing="2" first="0"
        rows="#{flowScope.getNbPerson}" width="100%" dir="LTR"
        frame="border" rules="all" rowClasses="row1, row2"
        headerClass="head" columnClasses="column,,,,column"
        value="#{flowScope.getPersons}" var="person" bgcolor="#F1F1F1"
        id="persons">

        <h:column>
          <f:facet name="header">
            <f:verbatim>User ID</f:verbatim>
          </f:facet>

          <h:commandLink id="uid" value="#{person.uid}" action="show"
            title="#{person.lastName} #{person.firstName}">
            <f:setPropertyActionListener value="#{person}"
              target="#{flowScope.selectedPersonRow}" />
          </h:commandLink>
        </h:column>

        <h:column>
          <f:facet name="header">
            <f:verbatim>Firstname</f:verbatim>
          </f:facet>
          <h:outputText value="#{person.firstName}" />
        </h:column>

        <h:column>
          <f:facet name="header">
            <f:verbatim>Lastname</f:verbatim>
          </f:facet>
          <h:outputText value="#{person.lastName}" />
        </h:column>

        <!-- h:column>
          <f:facet name="header">
            <f:verbatim>Group</f:verbatim>
          </f:facet>
          <h:outputText value="#{person.group}" />
        </h:column -->

        <h:column>
          <f:facet name="header">
            <f:verbatim>Actions</f:verbatim>
          </f:facet>
          <h:commandButton value="Modify" action="modify" type="submit">
            <f:setPropertyActionListener value="#{person}"
              target="#{flowScope.selectedPersonRow}" />
          </h:commandButton>

          <h:commandButton value="Delete" action="delete" type="submit">
            <f:setPropertyActionListener value="#{person}"
              target="#{flowScope.selectedPersonRow}" />
          </h:commandButton>
        </h:column>
      </h:dataTable>

      <br />

      <h:panelGrid columns="2" cellpadding="10">
        <h:commandButton value="Add Person" action="add" type="submit" />
        Click here for add a new person on LDAP.
      </h:panelGrid>
    </h:form>

    <h:form>
      <h:commandLink action="back">
        Back to the home page
      </h:commandLink>
    </h:form>

  </ui:define>
</ui:composition>
